﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DIProject.ReceptionGoods
{
    public partial class DateRange : Form
    {
        private DIProject.Util.IDateRange dateRange;
        public DateRange(DIProject.Util.IDateRange _dateRange)
        {
            if (_dateRange == null)
                throw new ArgumentException("_dateRange");
            dateRange = _dateRange;
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (eDate.Value < bDate.Value)
            {
                MessageBox.Show("Дата начала должна быть больше или равна дате окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            dateRange.BeginDate = bDate.Value;
            dateRange.EndDate = eDate.Value;
            this.Close();
            
        }
    }
}